<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/2/10
 * Time: 10:55
 */

namespace Home\Controller;


class InvestmentController extends HomeController
{
    public function index(){
        $cate_id=I("get.cate_id",111,"int");
        $category=D("Category");
        $document=D("Document");
        $category_list=$category->getSameLevel($cate_id);
        $category_info=$category->info($cate_id);
        $this->assign("category_info",$category_info);
        $this->assign("category_list",$category_list);
        $news_list=$document->list_page($cate_id,4);
        $this->assign("news_list",$news_list);
        //print_r($news_list);exit;
        $this->assign("meta_title","投资者风险防范");
        $this->display();
    }

    public function detail(){
        $id=I("get.id",0,"int");
        $document=D("Document");
        $category=D("Category");
        $detail_data=$document->detail($id);
        $category_list=$category->getSameLevel($detail_data['category_id']);
        $category_info=$category->info($detail_data['category_id']);
        $this->assign("category_info",$category_info);
        $this->assign("category_list",$category_list);
        $this->assign("detail_data",$detail_data);
        $this->assign("meta_title","投资者风险防范");
        $this->display();
    }
    public function page(){
        $document=D("Document");
        $cate_id=I("get.cate_id",0,"int");
        $news_list=$document->list_page($cate_id,4);
        foreach($news_list['list'] as $key=>$val){
            $news_list['list'][$key]['create_time1']=date("Y-m",$val['create_time']);
            $news_list['list'][$key]['create_time2']=date("d",$val['create_time']);
        }
        $this->ajaxReturn($news_list);exit;

    }
}